﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Zenject.Example
{
	public class ZenjectExample : MonoBehaviour
	{
		public interface IBluetoothService
		{
			void Connect();
		}
		
		public class BluetoothService : IBluetoothService
		{
			public void Connect()
			{
				Debug.Log("Bluetooth Connected");
			}
		}
		
		[Inject]
		public IBluetoothService BLEService { get; set; }
		
		void Start()
		{
			var container = new DiContainer();
			
			// 注册
			container.Bind<IBluetoothService>().To<BluetoothService>()
				.AsSingle();


			// 注入
			container.Inject(this);
			
			
			BLEService.Connect();

		}
	}
}
